tone_synth object
This method inserts a rest or pause into the music for a specified number of milliseconds.
bool rest_ms(double time)
Parameters:
time
Number of milliseconds to rest
Return value:
true on success, false on failure.
Remarks:
This method can also be used as a fast forward option.
As the tone synth supports chords, it is essential that you call this method or the rest method before moving on to your next phrase, otherwise all notes will be mashed into one area.
Example:
// Make a C major chord in the bass and a spread out C major chord as the melody. This uses the rest method to spread the notes.
tone_synth synth;
void main()
{
synth.tempo=120;
//chord
synth.waveform_type=2;
synth.note_ms("C4", 2000);
synth.note_ms("E4", 2000);
synth.note_ms("G4", 2000);
//melody
synth.waveform_type=3;
synth.note_ms("C5", 333);
synth.rest_ms(333);
synth.note_ms("E5", 333);
synth.rest_ms(333);
synth.note_ms("G5", 333);
synth.rest_ms(333);
synth.note_ms("C6", 1000);
synth.write_wave_file("synth.wav");
}